<template>
  <div class="tableCom">
    <div class="tableHead">
      <div class="tableHeadItem" v-for="(item,index) in head" :key="index" :style="{width:item.flex}">{{ item.title }}
      </div>
    </div>
    <Vue3SeamlessScroll :step="0.5" :wheel="true" :hover="true" :list="list" class="tableBody">
      <div class="tableBody2" v-for="(item,index) in list" :key="index">
        <div class="tableBody2Item" :style="{width: head[0].flex}">
          <span class="num">{{item.content}}</span>
        </div>
        <div class="tableBody2Item" :style="{width: head[1].flex}">
          <span class="num">{{item.device}}</span>
        </div>
        <div class="tableBody2Item" :style="{width: head[2].flex}">
          <span class="num">{{item.time}}</span>
        </div>
      </div>
    </Vue3SeamlessScroll>
  </div>
</template>

<script>
import {Vue3SeamlessScroll} from "vue3-seamless-scroll";

export default {
  name: "tableCom",
  components: {Vue3SeamlessScroll},
  props: {
    head: {
      type: Array,
      default() {
        return [{
          title: '告警内容',
          flex: '30%'
        }, {
          title: '告警设备',
          flex: '25%'
        }, {
          title: '告警时间',
          flex: '45%'
        }];
      }
    },
    list: {
      type: Array,
      default() {
        return [];
      }
    },
  },
  data() {
    return {}
  },
}
</script>

<style lang="scss" scoped>
.tableCom {
  width: calc(100% - 0px);
  margin-left: 0px;
  position: relative;
  height: 100%;
  overflow: hidden;

  .tableHead {
    width: 100%;
    height: 39px;
    background: rgba(#a6c6fd, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    flex-direction: row;

    .tableHeadItem {
      font-size: 14px;
      font-family: PingFang SC-Bold, PingFang SC;
      font-weight: bold;
      color: #fff;
      text-align: center;
    }
  }

  .tableBody {
    position: relative;
    height: calc(100% - 34px);
    overflow: hidden;

    .tableBody2 {
      min-height: 34px;
      padding-top: 5px;
      padding-bottom: 5px;
      background: rgba(#308EFF, 0);
      display: flex;
      justify-content: center;
      align-items: center;
      flex-wrap: nowrap;
      flex-direction: row;

      .tableBody2Item {
        font-size: 14px;
        font-family: MicrosoftYaHei;
        font-weight: 400;
        color: #CAD3ED;
        text-shadow: 0px 4px 10px rgba(0, 42, 108, 0.12);
        text-align: center;

        .num {
          width: calc(100% - 0px);
          overflow: hidden;
          text-align: center;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }

    .tableBody2:nth-child(2n) {
      background: rgba(#a6c6fd, 0.24);
    }
  }

  .status {
    color: rgba(13, 206, 242, 1);
  }
}

.zc {
  font-size: 14px;
  font-family: PingFang SC-Bold, PingFang SC;
  font-weight: bold;
  color: #46FFBE;
}

.yc {
  font-size: 14px;
  font-family: PingFang SC-Bold, PingFang SC;
  font-weight: bold;
  color: #FF5B5B;
}
</style>
